home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Resources / Online / Miami / MiamiSDK / doc / MiamiPCap.doc < prev    next >
Text File  |  1997-12-27  |  20KB  |  795 lines

  1. TABLE OF CONTENTS
  2.  
  3. miamipcap.library/--general information--
  4. miamipcap.library/--PCap callbacks--
  5. miamipcap.library/MiamiPCapAmigaBPFHandle
  6. miamipcap.library/MiamiPCapAmigaDump
  7. miamipcap.library/MiamiPCapAmigaDumpClose
  8. miamipcap.library/MiamiPCapAmigaDumpOpen
  9. miamipcap.library/MiamiPCapAmigaFile
  10. miamipcap.library/MiamiPCapBPFImage
  11. miamipcap.library/MiamiPCapClose
  12. miamipcap.library/MiamiPCapCompile
  13. miamipcap.library/MiamiPCapDatalink
  14. miamipcap.library/MiamiPCapDispatch
  15. miamipcap.library/MiamiPCapGeterr
  16. miamipcap.library/MiamiPCapInit
  17. miamipcap.library/MiamiPCapIsSwapped
  18. miamipcap.library/MiamiPCapLookupdev
  19. miamipcap.library/MiamiPCapLookupnet
  20. miamipcap.library/MiamiPCapLoop
  21. miamipcap.library/MiamiPCapMajorVersion
  22. miamipcap.library/MiamiPCapMinorVersion
  23. miamipcap.library/MiamiPCapNext
  24. miamipcap.library/MiamiPCapOpenLive
  25. miamipcap.library/MiamiPCapOpenOffline
  26. miamipcap.library/MiamiPCapPerror
  27. miamipcap.library/MiamiPCapSetCallbackType
  28. miamipcap.library/MiamiPCapSetFilter
  29. miamipcap.library/MiamiPCapSnapshot
  30. miamipcap.library/MiamiPCapStats
  31. miamipcap.library/MiamiPCapStrerror
  32. miamipcap.library/--general information--
  33.  
  34.     Miami:libs/miamipcap.library is an implementation of the
  35.     libpcap software suite, a packet monitoring mechanism built on top of
  36.     BPF, which provides high-level filtering functions.
  37.  
  38.     MiamiPCap is implemented on top of MiamiBPF, which in turn uses the
  39.     packet monitoring mechanism in Miami 1.9.3 and above, i.e.  MiamiPCap
  40.     only works with the registered version of Miami.
  41.  
  42.     The main advantage of MiamiPCap over lower-level packet monitoring
  43.     mechanisms is that MiamiPCap allows an application to specify ASCII
  44.     filter strings to select a set of packets, e.g.  something like
  45.  
  46.     icmp[0] != 8 and icmp!= 0
  47.  
  48.     which would select all ICMP packets that are not echo requests or
  49.     replies.
  50.  
  51.     MiamiPCap has a built-in compiler and code optimizer to convert such
  52.     ASCII strings into the binary BPF program code sequences required by
  53.     the underlying MiamiBPF suite.
  54.  
  55.     The primary use of MiamiPCap is in programs such as TCPDump.
  56.  
  57. miamipcap.library/--PCap callbacks--     miamipcap.library/--PCap callbacks--
  58.  
  59.     PCap calls a callback function in your program for each packet
  60.     received, which has not been filtered out.  The proper declaration of
  61.     the callback function is:
  62.  
  63.     void pcapcallback(void *user,struct pcap_pkthdr *pkthdr,char
  64.     *packet);
  65.  
  66.     The default CPU type for callbacks is MIAMICPU_M68KREG (parameters
  67.     passed on the stack), regardless of which API is used.
  68.     miamipcap.library versions 3 and higher support the new call
  69.     MiamiPCapSetCallbackType() to change the CPU type used for callbacks.
  70.  
  71. miamipcap.library/MiamiPCapAmigaBPFHandle
  72.  
  73.    NAME
  74.     MiamiPCapAmigaBPFHandle -- returns the BPF handle associated with a
  75.     pcap unit
  76.  
  77.    SYNOPSIS
  78.     bpfhandle = MiamiPCapAmigaBPFHandle( p    );
  79.     D0                     A0
  80.  
  81.     int MiamiPCapAmigaBPFHandle( pcap_t *p );
  82.  
  83.    FUNCTION
  84.     Returns the BPF handle associated with a pcap unit.
  85.  
  86.    INPUTS
  87.     p - pcap unit handle
  88.  
  89.    RESULT
  90.     bpfhandle (D0) - BPF handle
  91.  
  92. miamipcap.library/MiamiPCapAmigaDump     miamipcap.library/MiamiPCapAmigaDump
  93.  
  94.    NAME
  95.     MiamiPCapAmigaDump -- dump a packet to a save file
  96.  
  97.    SYNOPSIS
  98.     MiamiPCapAmigaDump( filehandle, h, sp );
  99.                 A0        A1 A2
  100.  
  101.     void MiamiPCapAmigaDump( pcap_dumper_t *filehandle, struct
  102.         pcap_pkthdr *h, u_char *sp );
  103.  
  104.    FUNCTION
  105.     Dumps the packet specified in sp to the specified save file, using
  106.     the packet header passed in h.
  107.  
  108.     The file handle MUST have been created by an earlier call to
  109.     MiamiPCapAmigaDumpOpen.
  110.  
  111.    INPUTS
  112.     filehandle - file handle
  113.  
  114.     h - packet header
  115.  
  116.     sp - data
  117.  
  118. miamipcap.library/MiamiPCapAmigaDumpClose
  119.  
  120.    NAME
  121.     MiamiPCapAmigaDumpClose -- closes an open save file
  122.  
  123.    SYNOPSIS
  124.     MiamiPCapAmigaDumpClose( filehandle );
  125.                  A0
  126.  
  127.     void MiamiPCapAmigaDumpClose( pcap_dumper_t *filehandle );
  128.  
  129.    FUNCTION
  130.     Closes the indicated save file.
  131.  
  132.     The file must have been opened earlier by a call to
  133.     MiamiPCapAmigaDumpOpen.
  134.  
  135.    INPUTS
  136.     filehandle - file handle
  137.  
  138. miamipcap.library/MiamiPCapAmigaDumpOpen
  139.  
  140.    NAME
  141.     MiamiPCapAmigaDumpOpen -- opens a save file to dump packets
  142.  
  143.    SYNOPSIS
  144.     filehandle = MiamiPCapAmigaDumpOpen( p, fname );
  145.     D0                     A0 A1
  146.  
  147.     pcap_dumper_t *MiamiPCapAmigaDumpOpen( pcap_t *p, char *fname );
  148.  
  149.    FUNCTION
  150.     Opens a save file for the specified unit.  The returned file handle
  151.     can later be used in MiamiPCapAmigaDump calls to dump packets to the
  152.     save file.
  153.  
  154.     A return value of NULL indicates that an error has occured.
  155.  
  156.     The filehandle later needs to be closed by calling
  157.     MiamiPCapAmigaDumpClose.
  158.  
  159.    INPUTS
  160.     p - pcap unit handle
  161.  
  162.     fname - file name
  163.  
  164.    RESULT
  165.     filehandle (D0) - file handle
  166.  
  167. miamipcap.library/MiamiPCapAmigaFile     miamipcap.library/MiamiPCapAmigaFile
  168.  
  169.    NAME
  170.     MiamiPCapAmigaFile -- return Amiga file handle for save file
  171.  
  172.    SYNOPSIS
  173.     handle = MiamiPCapAmigaFile( p    );
  174.     D0                 A0
  175.  
  176.     BPTR MiamiPCapAmigaFile( pcap_t *p );
  177.  
  178.    FUNCTION
  179.     returns the Amiga file handle for the current save file.  For pOS a
  180.     (struct pOS_FileHandle *) is returned instead of a BPTR.
  181.  
  182.    INPUTS
  183.     p - pcap unit handle
  184.  
  185.    RESULT
  186.     handle (D0) - filehandle
  187.  
  188. miamipcap.library/MiamiPCapBPFImage      miamipcap.library/MiamiPCapBPFImage
  189.  
  190.    NAME
  191.     MiamiPCapBPFImage -- disassemble a compiled BPF instruction
  192.  
  193.    SYNOPSIS
  194.     d  = MiamiPCapBPFImage( pi, n  );
  195.     D0            A0  D0
  196.  
  197.     char *MiamiPCapBPFImage( struct bpf_insn *pi, int n );
  198.  
  199.    FUNCTION
  200.     Disassembles a compiled BPF instruction into a text string.
  201.  
  202.     The two parameters are the BPF instruction and the offset (PC) of the
  203.     instruction relative to the BPF program.
  204.  
  205.     The returned string contains the disassembled text representing the
  206.     BPF instruction.  The text pointer points to static space that does
  207.     not have to be freed.  It is overwritten with the next call to
  208.     MiamiPCapBPFImage.
  209.  
  210.    INPUTS
  211.     pi - bpf instruction
  212.  
  213.     n - instruction offset (PC)
  214.  
  215.    RESULT
  216.     d (D0) - disassembled code
  217.  
  218. miamipcap.library/MiamiPCapClose         miamipcap.library/MiamiPCapClose
  219.  
  220.    NAME
  221.     MiamiPCapClose -- closes a pcap unit
  222.  
  223.    SYNOPSIS
  224.     MiamiPCapClose( p  );
  225.             A0
  226.  
  227.     void MiamiPCapClose( pcap_t *p );
  228.  
  229.    FUNCTION
  230.     Closes a pcap unit which was previously opened by a call to
  231.     MiamiPCapOpenLive or MiamiPCapOpenOffline.
  232.  
  233.    INPUTS
  234.     p - pcap unit handle
  235.  
  236. miamipcap.library/MiamiPCapCompile       miamipcap.library/MiamiPCapCompile
  237.  
  238.    NAME
  239.     MiamiPCapCompile -- compile a filter string into a BPF program
  240.  
  241.    SYNOPSIS
  242.     error = MiamiPCapCompile( p, program, buf, optimize, mask );
  243.     D0              A0 A1       A2   D0         D1
  244.  
  245.     int MiamiPCapCompile( pcap_t *p, struct bpf_program *program, char
  246.         *buf, int optimize, bpf_u_int32 mask );
  247.  
  248.    FUNCTION
  249.     Compiles the filter string passed in 'buf' into a BPF program.    The
  250.     resulting program is stored in the structure passed in 'program'.
  251.  
  252.     If 'optimize' is different from zero then the BPF code optimizer is
  253.     executed on the resulting program to compress the code.  'optimize'
  254.     should always be used except if you suspect a bug in the optimizer.
  255.  
  256.     'mask' is the netmask for the interface the program is supposed to
  257.     execute on.
  258.  
  259.     The function returns zero on success and a non-zero value on failure.
  260.  
  261.    INPUTS
  262.     p - pcap unit handle
  263.  
  264.     program - BPF program structure
  265.  
  266.     buf - filter string
  267.  
  268.     optimize - optimize flag
  269.  
  270.     mask - netmask
  271.  
  272.    RESULT
  273.     error (D0) - error code
  274.  
  275. miamipcap.library/MiamiPCapDatalink      miamipcap.library/MiamiPCapDatalink
  276.  
  277.    NAME
  278.     MiamiPCapDatalink -- return the datalink layer packet type
  279.  
  280.    SYNOPSIS
  281.     type = MiamiPCapDatalink( p  );
  282.     D0              A0
  283.  
  284.     int MiamiPCapDatalink( pcap_t *p );
  285.  
  286.    FUNCTION
  287.     returns the datalink layer packet type, i.e.  one of the DLT_...
  288.     constants in <net/bpf.h>.  For MiamiBPF the only possible value is
  289.     currently DLT_MIAMI.
  290.  
  291.    INPUTS
  292.     p - pcap unit handle
  293.  
  294.    RESULT
  295.     type (D0) - type
  296.  
  297. miamipcap.library/MiamiPCapDispatch      miamipcap.library/MiamiPCapDispatch
  298.  
  299.    NAME
  300.     MiamiPCapDispatch -- collect and process packets
  301.  
  302.    SYNOPSIS
  303.     count = MiamiPCapDispatch( p, cnt, callback, user );
  304.     D0               A0 D0   A1         A2
  305.  
  306.     int MiamiPCapDispatch( pcap_t *p, int cnt, pcap_handler callback,
  307.         u_char *user );
  308.  
  309.    FUNCTION
  310.     Collect and process packets for the specified pcap unit.
  311.  
  312.     cnt specifies the maximum number of packets to process before
  313.     returning.  A cnt of -1 processes all the packets received in one
  314.     buffer.  A cnt of 0 processes all packets until an error occurs (or
  315.     EOF is reached for a save file).
  316.  
  317.     callback specifies a PCap callback functions, as explained in -- PCap
  318.     callbacks --.  The parameter 'user' is the user parameter for the
  319.     callback function.
  320.  
  321.     The returned value contains the number of packets read.  0 is
  322.     returned if EOF is reached in a save file.  -1 is returned to
  323.     indicate an error.
  324.  
  325.    INPUTS
  326.     p - pcap unit handle
  327.  
  328.     cnt - maximum number of packets
  329.  
  330.     callback - packet callback
  331.  
  332.     user - user data for callback
  333.  
  334.    RESULT
  335.     count (D0) - packet count
  336.  
  337. miamipcap.library/MiamiPCapGeterr        miamipcap.library/MiamiPCapGeterr
  338.  
  339.    NAME
  340.     MiamiPCapGeterr -- returns the current error string buffer
  341.  
  342.    SYNOPSIS
  343.     errbuf = MiamiPCapGeterr( p  );
  344.     D0              A0
  345.  
  346.     char *MiamiPCapGeterr( pcap_t *p );
  347.  
  348.    FUNCTION
  349.     Returns a pointer to the current error string buffer, i.e.  the ebuf
  350.     parameter for the MiamiPCapOpenLive or MiamiPCapOpenOffline call
  351.  
  352.    INPUTS
  353.     p - pcap unit handle
  354.  
  355.    RESULT
  356.     errbuf (D0) - error buffer
  357.  
  358. miamipcap.library/MiamiPCapInit           miamipcap.library/MiamiPCapInit
  359.  
  360.    NAME
  361.     MiamiPCapInit -- initialize MiamiPCap
  362.  
  363.    SYNOPSIS
  364.     MiamiPCapInit( MiamiBase, SocketBase );
  365.                A0      A0
  366.  
  367.     void MiamiPCapInit( struct Library *MiamiBase, struct Library
  368.         *SocketBase );
  369.  
  370.    FUNCTION
  371.     Initializes MiamiPCap for use.    You MUST call this function before
  372.     calling any other function in miamipcap.library.
  373.  
  374.    INPUTS
  375.     MiamiBase - Library base of miami.library
  376.  
  377.     SocketBase - Library base of bsdsocket.library
  378.  
  379.    NOTE
  380.     You need to open miami.library V6 or higher and bsdsocket.library V4
  381.     or higher before calling this function.  Mind the version numbers !
  382.     Using miamipcap.library with older library versions will cause
  383.     crashes.
  384.  
  385. miamipcap.library/MiamiPCapIsSwapped     miamipcap.library/MiamiPCapIsSwapped
  386.  
  387.    NAME
  388.     MiamiPCapIsSwapped -- check byte order of save file
  389.  
  390.    SYNOPSIS
  391.     bool = MiamiPCapIsSwapped( p  );
  392.     D0               A0
  393.  
  394.     int MiamiPCapIsSwapped( pcap_t *p );
  395.  
  396.    FUNCTION
  397.     returns TRUE if the save file for this pcap unit uses a different
  398.     byte order than the current system, and FALSE if the byte order is
  399.     the same.
  400.  
  401.    INPUTS
  402.     p - pcap unit handle
  403.  
  404.    RESULT
  405.     bool (D0) - bool
  406.  
  407. miamipcap.library/MiamiPCapLookupdev     miamipcap.library/MiamiPCapLookupdev
  408.  
  409.    NAME
  410.     MiamiPCapLookupdev -- finds a suitable interface name
  411.  
  412.    SYNOPSIS
  413.     name = MiamiPCapLookupdev( ebuf );
  414.     D0               A0
  415.  
  416.     char *MiamiPCapLookupdev( char *ebuf );
  417.  
  418.    FUNCTION
  419.     Finds a suitable interface name for use with MiamiPCap, that can be
  420.     used as a default name if the user has not explicitly specified an
  421.     interface.
  422.  
  423.     A NULL return value indicates that an error has occured.  If the
  424.     return value is non-NULL, then it is a pointer to a valid interface
  425.     name in static storage, i.e.  the pointer does not have to be freed,
  426.     but the name will be overwritten by future calls to
  427.     MiamiPCapLookupdev.
  428.  
  429.    INPUTS
  430.     ebuf - buffer for error string
  431.  
  432.    RESULT
  433.     name (D0) - interface name
  434.  
  435. miamipcap.library/MiamiPCapLookupnet     miamipcap.library/MiamiPCapLookupnet
  436.  
  437.    NAME
  438.     MiamiPCapLookupnet -- finds the interface address and netmask
  439.  
  440.    SYNOPSIS
  441.     error = MiamiPCapLookupnet( device, netp, maskp, ebuf );
  442.     D0                A0        A1      A2     A3
  443.  
  444.     int MiamiPCapLookupnet( char *device, bpf_u_int32 *netp, bpf_u_int32
  445.         *maskp, char *ebuf );
  446.  
  447.    FUNCTION
  448.     Finds the interface (IP) address and the netmask for the specified
  449.     interface.
  450.  
  451.     The return code is zero for success and non-zero for failure, in
  452.     which case the error buffer will contain an error message.
  453.  
  454.     The pointers netp and maskp need to point to variables of type
  455.     bpf_u_int32, which will be filled with the IP address and netmask of
  456.     the specified interface, respectively.
  457.  
  458.    INPUTS
  459.     device - interface name
  460.  
  461.     netp - pointer to address
  462.  
  463.     maskp - pointer to netmask
  464.  
  465.     ebuf - buffer for error string
  466.  
  467.    RESULT
  468.     error (D0) - error code
  469.  
  470. miamipcap.library/MiamiPCapLoop           miamipcap.library/MiamiPCapLoop
  471.  
  472.    NAME
  473.     MiamiPCapLoop -- loop to collect and process packets
  474.  
  475.    SYNOPSIS
  476.     count = MiamiPCapLoop( p, cnt, callback, user );
  477.     D0               A0 D0   A1     A2
  478.  
  479.     int MiamiPCapLoop( pcap_t *p, int cnt, pcap_handler callback, u_char
  480.         *user );
  481.  
  482.    FUNCTION
  483.     Same as MiamiPCapDispatch, but with one difference:
  484.  
  485.     MiamiPCapDispatch returns as soon as some packets have been read (or
  486.     another condition such as a timeout or an error has occured).
  487.     MiamiPCapLoop keeps reading until cnt packets have been read or an
  488.     error has occured.
  489.  
  490.    INPUTS
  491.     p - pcap unit handle
  492.  
  493.     cnt - number of packets
  494.  
  495.     callback - packet callback
  496.  
  497.     user - user data for callback
  498.  
  499.    RESULT
  500.     count (D0) - packet count
  501.  
  502. miamipcap.library/MiamiPCapMajorVersion
  503.  
  504.    NAME
  505.     MiamiPCapMajorVersion -- return major version number for save file
  506.  
  507.    SYNOPSIS
  508.     version = MiamiPCapMajorVersion( p  );
  509.     D0                 A0
  510.  
  511.     int MiamiPCapMajorVersion( pcap_t *p );
  512.  
  513.    FUNCTION
  514.     returns the major version number of the pcap used to write the save
  515.     file.
  516.  
  517.    INPUTS
  518.     p - pcap unit handle
  519.  
  520.    RESULT
  521.     version (D0) - version
  522.  
  523. miamipcap.library/MiamiPCapMinorVersion
  524.  
  525.    NAME
  526.     MiamiPCapMinorVersion -- return minor version number for save file
  527.  
  528.    SYNOPSIS
  529.     version = MiamiPCapMinorVersion( p  );
  530.     D0                 A0
  531.  
  532.     int MiamiPCapMinorVersion( pcap_t *p );
  533.  
  534.    FUNCTION
  535.     returns the minor version number of the pcap used to write the save
  536.     file.
  537.  
  538.    INPUTS
  539.     p - pcap unit handle
  540.  
  541.    RESULT
  542.     version (D0) - version
  543.  
  544. miamipcap.library/MiamiPCapNext           miamipcap.library/MiamiPCapNext
  545.  
  546.    NAME
  547.     MiamiPCapNext -- read one packet
  548.  
  549.    SYNOPSIS
  550.     packet = MiamiPCapNext( p, h  );
  551.     D0            A0 A1
  552.  
  553.     u_char *MiamiPCapNext( pcap_t *p, struct pcap_pkthdr *h );
  554.  
  555.    FUNCTION
  556.     Similar to MiamiPCapDispatch, but reads only a single packet and
  557.     returns the pointer to the packet data.  No callback function is
  558.     called.  The specified packet header is used as a template when
  559.     reading the packet.
  560.  
  561.    INPUTS
  562.     p - pcap unit handle
  563.  
  564.     h - packet header
  565.  
  566.    RESULT
  567.     packet (D0) - packet data
  568.  
  569. miamipcap.library/MiamiPCapOpenLive      miamipcap.library/MiamiPCapOpenLive
  570.  
  571.    NAME
  572.     MiamiPCapOpenLive -- open a live pcap unit
  573.  
  574.    SYNOPSIS
  575.     p  = MiamiPCapOpenLive( device, snaplen, promisc, toms, ebuf );
  576.     D0            A0    D0     D1      D2    A1
  577.  
  578.     pcap_t *MiamiPCapOpenLive( char *device, int snaplen, int promisc,
  579.         int toms, char *ebuf );
  580.  
  581.    FUNCTION
  582.     Opens a live PCap monitoring unit, for the specified interface.
  583.  
  584.     A return value of NULL indicates that an error has occured, in which
  585.     case the buffer bassed in ebuf will contain an ASCII error message.
  586.  
  587.     snaplen is the maximum packet size you want PCap to preserve.
  588.     promisc is a boolean variable indicating promiscuous mode and
  589.     currently MUST be zero.  Promiscuous mode is not currently supported
  590.     because of limitations in the Amiga SANA-II standard.
  591.  
  592.     If toms is a non-zero value then it is considered a read timeout in
  593.     milliseconds for later calls to the packet monitoring functions.  A
  594.     value of zero means 'no timeout', i.e.    wait indefinitely.
  595.  
  596.     The error string buffer passed to MiamiPCapOpenLive is used not only
  597.     for this single function call, but for ALL error strings resulting
  598.     from future function calls for this pcap unit.
  599.  
  600.    INPUTS
  601.     device - interface name
  602.  
  603.     snaplen - maximum packet length to copy
  604.  
  605.     promisc - promisc mode, currently MUST be zero
  606.  
  607.     toms - timeout in milliseconds
  608.  
  609.     ebuf - buffer for error string
  610.  
  611.    RESULT
  612.     p (D0) - pcap unit handle
  613.  
  614. miamipcap.library/MiamiPCapOpenOffline miamipcap.library/MiamiPCapOpenOffline
  615.  
  616.    NAME
  617.     MiamiPCapOpenOffline -- open a savefile for reading
  618.  
  619.    SYNOPSIS
  620.     p  = MiamiPCapOpenOffline( fname, ebuf );
  621.     D0               A0      A1
  622.  
  623.     pcap_t *MiamiPCapOpenOffline( char *fname, char *ebuf );
  624.  
  625.    FUNCTION
  626.     Opens an offline PCap monitoring unit.    Packets are read from the
  627.     specified file, not from the network.  The file must have been
  628.     created by MiamiPCap earlier.
  629.  
  630.     A return value of NULL indicates that an error has occured, in which
  631.     case the buffer bassed in ebuf will contain an ASCII error message.
  632.  
  633.     The error string buffer passed to MiamiPCapOpenLive is used not only
  634.     for this single function call, but for ALL error strings resulting
  635.     from future function calls for this pcap unit.
  636.  
  637.    INPUTS
  638.     fname - file name
  639.  
  640.     ebuf - buffer for error string
  641.  
  642.    RESULT
  643.     p (D0) - pcap unit handle
  644.  
  645. miamipcap.library/MiamiPCapPerror        miamipcap.library/MiamiPCapPerror
  646.  
  647.    NAME
  648.     MiamiPCapPerror -- prints the current pcap error string to the
  649.     console
  650.  
  651.    SYNOPSIS
  652.     MiamiPCapPerror( p, prefix );
  653.              A0 A1
  654.  
  655.     void MiamiPCapPerror( pcap_t *p, char *prefix );
  656.  
  657.    FUNCTION
  658.     Prints the current pcap error string to the console, in the same
  659.     format used by the Un*x perror() function call.
  660.  
  661.    INPUTS
  662.     p - pcap unit handle
  663.  
  664.     prefix - error prefix
  665.  
  666. miamipcap.library/MiamiPCapSetCallbackType
  667.  
  668.    NAME
  669.     MiamiPCapSetCallbackType -- set the CPU for callbacks (V3)
  670.  
  671.    SYNOPSIS
  672.     success = MiamiPCapSetCallbackType( pi, c  );
  673.     D0                    A0    D0
  674.  
  675.     long MiamiPCapSetCallbackType( pcap_t *pi, long c );
  676.  
  677.    FUNCTION
  678.     Set the CPU used for callbacks, i.e.  one of MIAMICPU_...  The
  679.     default CPU is MIAMICPU_M68KREG, regardless of which API (68k or PPC)
  680.     is used.  Other CPU types require special support in
  681.     miamipcap.library and Miami.  If the requested CPU is not supported
  682.     for callbacks then FALSE is returned.  Otherwise TRUE is returned and
  683.     all subsequent callbacks use the new CPU calling conventions.
  684.  
  685.    INPUTS
  686.     pi - pcap unit handle
  687.  
  688.     c - CPU type
  689.  
  690.    RESULT
  691.     success (D0) - success indicator
  692.  
  693. miamipcap.library/MiamiPCapSetFilter     miamipcap.library/MiamiPCapSetFilter
  694.  
  695.    NAME
  696.     MiamiPCapSetFilter -- attach a program to a pcap unit as a filter
  697.  
  698.    SYNOPSIS
  699.     error = MiamiPCapSetFilter( p, prog );
  700.     D0                A0 A1
  701.  
  702.     int MiamiPCapSetFilter( pcap_t *p, struct bpf_program *prog );
  703.  
  704.    FUNCTION
  705.     Ataches a compiled program to the specified pcap unit as a filter.
  706.     The program has to be a valid BPF program, typically returned by a
  707.     previous call to MiamiPCapCompile.  The new filter replaces the
  708.     previous filter (if any).
  709.  
  710.     A return code of zero indicates success, a non-zero return code
  711.     indicates failure.
  712.  
  713.    INPUTS
  714.     p - pcap unit handle
  715.  
  716.     prog - compiled program
  717.  
  718.    RESULT
  719.     error (D0) - error code
  720.  
  721. miamipcap.library/MiamiPCapSnapshot      miamipcap.library/MiamiPCapSnapshot
  722.  
  723.    NAME
  724.     MiamiPCapSnapshot -- return the maximum snapshot length
  725.  
  726.    SYNOPSIS
  727.     len = MiamiPCapSnapshot( p  );
  728.     D0             A0
  729.  
  730.     int MiamiPCapSnapshot( pcap_t *p );
  731.  
  732.    FUNCTION
  733.     returns the maximum packet length used for snapshot (i.e.  the value
  734.     passed in the snaplen parameter to MiamiPCapOpenLive.
  735.  
  736.    INPUTS
  737.     p - pcap unit handle
  738.  
  739.    RESULT
  740.     len (D0) - length
  741.  
  742. miamipcap.library/MiamiPCapStats         miamipcap.library/MiamiPCapStats
  743.  
  744.    NAME
  745.     MiamiPCapStats -- return packet statistics
  746.  
  747.    SYNOPSIS
  748.     error = MiamiPCapStats( p, st );
  749.     D0            A0 A1
  750.  
  751.     int MiamiPCapStats( pcap_t *p, pcap_stat *st );
  752.  
  753.    FUNCTION
  754.     Returns statistics for the specified pcap unit handle, by
  755.  
  756.    filling
  757.     in the statistics structure passed to the function.
  758.  
  759.     If the returned error code is 0 then the contents of the statistics
  760.     structure are valid.
  761.  
  762.    INPUTS
  763.     p - pcap unit handle
  764.  
  765.     st - statistics
  766.  
  767.    RESULT
  768.     error (D0) - error code
  769.  
  770. miamipcap.library/MiamiPCapStrerror      miamipcap.library/MiamiPCapStrerror
  771.  
  772.    NAME
  773.     MiamiPCapStrerror -- converts an error number to an error string
  774.  
  775.    SYNOPSIS
  776.     errstr = MiamiPCapStrerror( errnum );
  777.     D0                D0
  778.  
  779.     char *MiamiPCapStrerror( int errnum );
  780.  
  781.    FUNCTION
  782.     Converts an error number into an error string.    The returned pointer
  783.     points to static storage and does not have to be freed.  It is
  784.     overwritten with the next call to MiamiPCapStrerror.
  785.  
  786.     The returned pointer is independent of pcap units and NOT identical
  787.     to the error string buffer for any particular pcap unit.
  788.  
  789.    INPUTS
  790.     errnum - error number
  791.  
  792.    RESULT
  793.     errstr (D0) - error string
  794.  
  795.